<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.onload=function ()
{
	var oUl=document.getElementById('ul1');
	var aLi=oUl.getElementsByTagName('li');
	
	for(var i=0;i<aLi.length;i++)
	{
		if(aLi[i].className=='box')
		{
			aLi[i].style.background='red';
		}
	}
};
</script>
</head>

<body>
<ul id="ul1">
	<li class="box"></li>
	<li class="box"></li>
	<li></li>
	<li></li>
	<li></li>
	<li class="box"></li>
	<li></li>
</ul>
</body>
</html>
